package com.ruoyi.channel.mapper;

import com.ruoyi.channel.domain.ChannelApply;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.List;

/**
 * 渠道商审核Mapper接口
 * 
 * @author ruoyi
 * @date 2025-04-09
 */
public interface ChannelApplyMapper 
{
    /**
     * 查询渠道商审核
     * 
     * @param id 渠道商审核主键
     * @return 渠道商审核
     */
    public ChannelApply selectChannelApplyById(Long id);

    /**
     * 查询渠道商审核列表
     * 
     * @param channelApply 渠道商审核
     * @return 渠道商审核集合
     */
    public List<ChannelApply> selectChannelApplyList(ChannelApply channelApply);

    /**
     * 新增渠道商审核
     * 
     * @param channelApply 渠道商审核
     * @return 结果
     */
    public int insertChannelApply(ChannelApply channelApply);

    /**
     * 修改渠道商审核
     * 
     * @param channelApply 渠道商审核
     * @return 结果
     */
    public int updateChannelApply(ChannelApply channelApply);

    /**
     * 删除渠道商审核
     * 
     * @param id 渠道商审核主键
     * @return 结果
     */
    public int deleteChannelApplyById(Long id);

    /**
     * 批量删除渠道商审核
     * 
     * @param ids 需要删除的数据主键集合
     * @return 结果
     */
    public int deleteChannelApplyByIds(Long[] ids);

    @Select("select user_invitation_code from t_user where user_tel = #{partnerTel}")
    String selectPartnerUserByTel(@Param("partnerTel") String partnerTel);

    @Update("update t_user set user_identity = #{userIdentity}, user_invited_code = #{userInvitationCode} where id = #{userId}")
    Integer updateUserIdentity(@Param("userId") Long userId,@Param("userIdentity") Integer userIdentity,@Param("userInvitationCode") String userInvitationCode);
    @Select("select user_invitation_code from t_user where id = #{userId}")
    String selectUserInvitetionCode(@Param("userId")Long userId);
}
